﻿Public Class frmAD_ThemLoaiNha

    Public tableLoaiNha As New DataTable
    Public loainhaDTO As New LoaiNhaDTO
    Public loainhaBUS As New LoaiNhaBUS

    Private Sub frmAD_ThemLoaiNha_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        tableLoaiNha = loainhaBUS.GetAll()
        dgv.DataSource = tableLoaiNha
    End Sub

    Private Sub btnThem_Click(sender As System.Object, e As System.EventArgs) Handles btnThem.Click
        loainhaDTO.TenLoaiNha = txtTen.Text
        loainhaDTO.MaLoaiNha = 1
        loainhaBUS.Insert(loainhaDTO)
        tableLoaiNha = loainhaBUS.GetAll()
        dgv.DataSource = tableLoaiNha
    End Sub
End Class